<!DOCTYPE html>
<html>
<header title="VUE Demo"></header>
<head lang="en">
    <meta charset="utf-8">
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="app">
    <button @click="increment">数据输出：{{ count }}</button>

    </div>

    <script src="https://unpkg.com/vue@next"></script>
    <script>
        const count = 0; 
        const app = Vue.createApp({
            data() {
                return {
                    count: 4
                }
            },
            methods:{
                increment(){
                    this.count++;
                }
            },

        })

        const vm = app.mount('#app')

        console.log(vm.$data.count) // => 4
        console.log(vm.count) // => 4

        // 修改 vm.count 的值也会更新 $data.count
        vm.count = 5
        console.log(vm.$data.count) // => 5

        // 反之亦然
        vm.$data.count = 6
        console.log(vm.count) // => 6

        vm.increment();
        console.log(vm.count);
    </script>
</body>

</html>